package com.sxm.yiwei.adapters.pinche;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;

import com.sxm.yiwei.R;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/10/24.
 */

public class PhotoAdapter extends BaseAdapter {
    private final LayoutInflater inflater;
    private Context context;
    private ArrayList<Bitmap> list;
    public PhotoAdapter(Context context,ArrayList<Bitmap> list) {
        this.context=context;
        this.list=list;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder=null;
        if (view==null){
            view=inflater.inflate(R.layout.car_verify_item,null);
            holder=new ViewHolder();
            holder.img=(ImageView)view.findViewById(R.id.iv_car_photo);
            holder.text=(TextView)view.findViewById(R.id.text);
            view.setTag(holder);
        }else {
            holder= (ViewHolder) view.getTag();
        }
        holder.img.setImageBitmap(list.get(i));
        return view;
    }
    private class ViewHolder{
        ImageView img;
        TextView text;
    }
}
